//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Chart
{
    public class UpDownBars : IOfficeXmlSerializable
    {
        private ExtensionElement _extension;
        private UpDownBar downBars;


        private int gapWidth;

        private UpDownBar upBars;

        public ExtensionElement Extension
        {
            get { return _extension; }
            set { _extension = value; }
        }

        public int GapWidth
        {
            get { return gapWidth; }
            set { gapWidth = value; }
        }

        public UpDownBar UpBars
        {
            get { return upBars; }
            set { upBars = value; }
        }

        public UpDownBar DownBars
        {
            get { return downBars; }
            set { downBars = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("upDownBars"))
            {
                GapWidth = c.ReadOptionalElementIntegerAttribute("gapWidth", 150);
                UpBars = c.ReadOptionalElementAs<UpDownBar>("upBars");
                DownBars = c.ReadOptionalElementAs<UpDownBar>("downBars");
                Extension = c.ReadOptionalElement<ExtensionElement>("extLst");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("upDownBars"))
            {
                c.WriteOptionalElementIntegerAttribute("gapWidth", GapWidth, 150);
                c.WriteOptionalElementAs(UpBars, "upBars");
                c.WriteOptionalElementAs(DownBars, "downBars");
                c.WriteOptionalElement(Extension);
            }
        }

        #endregion
    }
}